﻿using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Windows.Forms;

namespace InsertKickItButtonPlugin {

    [WriterPluginAttribute( "6E374884-A85E-42f4-84F4-25C9E6346E16" ,
        "Kick-It Button",
        ImagePath = "Images.KickItButtonImage.png",
        PublisherUrl = "http://www.tyronedavisjr.com",
        Description = "Helps you to embed a DotNetKicks Kick-It image counter within your post. Post has to be published first to your blog, then submitted on DotNetKicks.  You will then be provided code to embed within your post." )
    ]
    [InsertableContentSourceAttribute( "Kick-It Button" )]
    public class KickItPlugin : ContentSource {

        public override System.Windows.Forms.DialogResult CreateContent( System.Windows.Forms.IWin32Window dialogOwner, ref string content ) {

            DialogResult result = DialogResult.None;

            using (KickItForm window = new KickItForm( )) {
                result = window.ShowDialog( );
                if (result == DialogResult.OK) {
                    content = window.CodeSnippet;
                    result = window.DialogResult;
                }
            }

            if (result == DialogResult.None) result = DialogResult.Cancel;
            return result;
        }

    }
}
